# Contributor: Marc Vertes <mvertes@free.fr>
# Maintainer: Marc Vertes <mvertes@free.fr>
pkgname=mongodb-tools
pkgver=4.2.3
pkgrel=1
pkgdesc="The MongoDB tools provide import, export, and diagnostic capabilities."
url="https://github.com/mongodb/mongo-tools"
arch="all !s390x !mips !mips64"
license="Apache-2.0"
makedepends="$depends_dev go cyrus-sasl-dev openssl-dev libpcap-dev bash perl"
options="!check"
source="$pkgname-$pkgver.tar.gz::https://github.com/mongodb/mongo-tools/archive/r$pkgver.tar.gz
	fix-build.patch
	"
builddir="$srcdir/src/github.com/mongodb/mongo-tools"

prepare() {
	mkdir -p "${builddir%/*}"
	mv "$srcdir"/mongo-tools-r$pkgver "$builddir"
	default_prepare
}

build() {
	GOROOT=/usr/lib/go GOPATH="$srcdir" ./build.sh sasl ssl
}

package() {
	cd "$builddir/bin"
	local bindir="$pkgdir/usr/bin"
	mkdir -p "$bindir"
	cp bsondump mongostat mongofiles mongoexport mongoimport \
		mongorestore mongodump mongotop mongoreplay \
		"$bindir"
}

sha512sums="772719b450f8b656c22ac0126fee1e0fa58b5320c94ac6414b1d9af13e6437393c2482f2e386f4a73c84a2d1bfe0ea88df117a6a7ae87f4884477505cf662585  mongodb-tools-4.2.3.tar.gz
74e432b354fd75209b87461e54f79a173ba0d647a2e45a48d520ee9342236b6a50ef1c634312f4804402578b8534d59ebf10973ce90cae2bbe76407102f2b404  fix-build.patch"
